<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String path2 = request.getContextPath();
    String basePath2 = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path2 + "/";
%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type="text/javascript" src="<%=path2%>/HoganJS/handlebars-v4.0.11.js"></script>
    <title>Insert title here</title>
    <style type="text/css">
        li span {
            margin-left: 0px;
            cursor: pointer;
        }

        li span:hover {
            color: #427dff
        }

        /**按钮样式**/
        .subtn1 {
            background: #57a0ff;
            border-radius: 50px;
            background: -webkit-linear-gradient(top, #57a0ff, #57a1ff);
            background: -moz-linear-gradient(top, #57a0ff, #57a1ff);
            background: linear-gradient(top, #57a0ff, #57a1ff);
            background: -ms-linear-gradient(top, #57a0ff, #57a1ff);
            border: 1px solid #2576A8;
            box-shadow: 0 1px 2px #8AC1E2 inset, 0 -1px 0 #57a0ff inset;
            color: #fff;
            height: 40px;
            text-shadow: 1px 1px 0.5px #22629B;
            outline: none;
        }

        .btn {
            background: #57a0ff, background;
            border-radius: 50px;
            background: -webkit-linear-gradient(top, #57a0ff, #57a1ff);
            background: -moz-linear-gradient(top, #57a0ff, #57a1ff);
            background: linear-gradient(top, #57a0ff, #57a1ff);
            background: -ms-linear-gradient(top, #57a0ff, #57a1ff);
            border: 1px solid #2576A8;
            box-shadow: 0 1px 2px #8AC1E2 inset, 0 -1px 0 #57a0ff inset;
            color: #fff;
            height: 40px;
            text-shadow: 1px 1px 0.5px #22629B;
            outline: none;
        }

        .subtn1:hover {
            background: -webkit-linear-gradient(top, #8DC9EF, #4E9FD1);
            background: -moz-linear-gradient(top, #8DC9EF, #4E9FD1);
            background: linear-gradient(top, #8DC9EF, #4E9FD1);
            background: -ms-linear-gradient(top, #8DC9EF, #4E9FD1);
        }

        .btn:hover {
            background: -webkit-linear-gradient(top, #8DC9EF, #4E9FD1);
            background: -moz-linear-gradient(top, #8DC9EF, #4E9FD1);
            background: linear-gradient(top, #8DC9EF, #4E9FD1);
            background: -ms-linear-gradient(top, #8DC9EF, #4E9FD1);
        }

        .modal-data {
            visibility: hidden;
            z-index: 1001;
            width: 1000px;
            min-height: 500px;
            margin: 100px auto;
            background-color: #FFFFFF;
            /* border: 1px solid #C80B14;*/
            -moz-box-shadow: 0 10px 20px #8AC1E2 inset, 0 -10px 0 #57a0ff inset;
            -webkit-box-shadow: 0 10px 20px #8AC1E2 inset, 0 -10px 0 #57a0ff inset;
            /*         box-shadow:0 0 10px #cccccc;
                    box-shadow: #cccccc; */
            box-shadow: 0 10px 20px #57a1ff inset, 0 -10px 0 #57a0ff inset;
            padding: 5px;
            text-align: center;
            position: fixed;
            left: 22%;
        }

        .modal-data1 td {
            padding-left: 15px;
            padding-right: 15px
        }

        .modal-data1 tr:FIRST-CHILD td {
            padding: 0px 10px;
        }

        .modal-data1 tr {
            padding-top: 30px
        }

        .modal-data1 form table {
            margin: 0px
        }

        input[type=checkbox] {
            padding: 0px;
            margin: 0px;
            text-align: right;
            width: 15px
        }

        .div_zilei {
            width: 600px;
            padding-left: 90px;
            height: 30px
        }

        .tr {
            height: 40px;
            background: #a9bbe0
        }

        .tr td {
            font-size: 14px;
            color: #ffffff
        }

        .tr_td {
            height: 40px;
        }

        .tr_td td {
            border-bottom: 1px solid #ededed;
            text-align: center;
        }

        tr td:nth-child(1) {
            font-size: 14px;
            color: #cccccc
        }

        .date {
            border: 0;
            background: #ffffff;
            text-align: center;
        }

        .tr_td td:nth-child(1) {
            border-left: 1px solid #cccccc;
        }

        .addTable.deleteTable:HOVER {
            cursor: pointer;
        }

        .fseq {
            width: 37px;
            border: 0;
            text-align: center;
            color: #cccccc
        }

        .jczl {
            padding-left: 100px;
        }

        .div_tj {
            margin-top: 40px;
            padding-right: 60px;
        }

        .text {
            border: 0;
            background: #ffffff;
            text-align: center;
        }

        .remuneration1 {
            width: 150px;
            border: 0;
            background: #ffffff;
            text-align: center;
        }

        .loading {
            margin: 100px 450px;
            display: block;
            width: 65px;
            height: 65px;
            border: 1px solid #ddd;
            border-radius: 5px;
            opacity: .7;
            background: url(../images/loading.gif) no-repeat;
        }

        .botton {
            float: left;
            margin-left: 80px;

        }

        .botton input {
            width: 100px;
        }

        .botton span {
            width: 80px;
        }

        span input {
            width: 120px;
        }

        .findBtn1 {
            margin-left: 50px;
        }
    </style>
</head>
<body>
<div id="modal-overlay">

</div>
<div class="modal-data">
    <div style="height: 60px">
        <ul>
            <li style="text-align: left;margin-left: 60px;height: 40px;line-height: 40px">
                <span style="margin-left: 30px;">名称：</span>
                <span>
				  		 	<input class="name1" type="text">
				  		</span>
                <button id="findBtn1" class="findBtn1">
                    查询
                </button>
                </span>
            </li>
        </ul>
    </div>

    <div style="width:100%; height:350px; overflow:scroll;">
        <form action="">
            <table class="head2" id="studebntList" style="width: auto;white-space:nowrap;border-spacing: 0px">
                <tr style="background: #f2f2f2;height: 30px;line-height: 20px;" class="sel">
                    <td></td>
                    <td>学员名称</td>
                    <td>编码</td>
                    <td>身份证号码</td>
                    <td>性别</td>
                    <td>手机</td>
                    <td>联系电话</td>
                    <td>入学日期</td>
                    <td>本地/异地</td>
                    <td>学员状态</td>
                    <td>应收金额</td>
                    <td>已收</td>
                    <td>欠费</td>
                    <td>优惠</td>
                    <td>科目一考试次数</td>
                    <td>科目二考试次数</td>
                    <td>单据状态</td>
                    <td>教练名称</td>
                </tr>
                <c:forEach items="${sharecartworegentryList}" var="sharecartworegentry" varStatus="s">
                    <tr>

                    </tr>
                </c:forEach>


            </table>

        </form>
    </div>

    <button class="subtn" id="subtn" style="width: 150px;position: absolute;bottom: 35px;font-size: 16px;left: 250px">
        确定
    </button>
    <button class="btn" style="width: 150px;position: absolute;bottom: 35px;font-size: 16px;right: 250px">
        关闭
    </button>


</div>
</body>
<script type="text/javascript" src="<%=path2%>/JQuery/jquery-1.8.2.js"></script>
<script id="table-template" type="text/x-handlebars-template">
    {{#isNull sList}}
    <tr style="background: #f2f2f2;height: 30px;line-height: 20px;" class="sel">
        <th style="width: 20px"></th>
        <td>学员名称</td>
        <td>编码</td>
        <td>身份证号码</td>
        <td>性别</td>
        <td>手机</td>
        <td>联系电话</td>
        <td>入学日期</td>
        <td>本地/异地</td>
        <td>学员状态</td>
        <td>应收金额</td>
        <td>已收</td>
        <td>欠费</td>
        <td>优惠</td>
        <td>科目一考试次数</td>
        <td>科目二考试次数</td>
        <td>单据状态</td>
        <td>教练名称</td>
    </tr>
    {{#each sList}}
    <tr>
        <td style="display: none;width: 20px;"><input type="text" class="fseq" name="fid" value="{{fid}}"
        ></td>
        <td class="fir"><input type="checkbox" value="{{fid}}" name="student"/></td>
        <td>{{xyname}}</td>
        <td>{{cfstudentno}}</td>
        <td>{{cfidcardno}}</td>

        {{#compare cfsex 1}}
        <td>男</td>
        {{/compare}}
        {{#compare cfsex 2}}
        <td>女</td>
        {{/compare}}
        {{#compare cfsex 3}}
        <td></td>
        {{/compare}}
        <td>{{cfmobile}}</td>
        <td>{{cfphone}}</td>
        <td>{{rxsj}}</td>

        {{#compare sllx 1}}
        <td>本地</td>
        {{/compare}}
        {{#compare sllx 2}}
        <td>异地</td>
        {{/compare}}
        {{#compare sllx 3}}
        <td></td>
        {{/compare}}
        {{#compare cfstubillstate 1}}
        <td>已报名</td>
        {{/compare}} {{#compare cfstubillstate 2}}
        <td>科目一通过</td>
        {{/compare}} {{#compare cfstubillstate 3}}
        <td>科目一未通过</td>
        {{/compare}} {{#compare cfstubillstate 4}}
        <td>科目二通过,科目三未开始</td>
        {{/compare}} {{#compare cfstubillstate 5}}
        <td>科目二未通过,科目三未开始</td>
        {{/compare}} {{#compare cfstubillstate 6}}
        <td>科目二练车中,科目三未开始</td>
        {{/compare}} {{#compare cfstubillstate 7}}
        <td>科目三通过,科目二通过</td>
        {{/compare}} {{#compare cfstubillstate 8}}
        <td>科目三未通过,科目二通过</td>
        {{/compare}} {{#compare cfstubillstate 9}}
        <td>科目三练车中,科目二通过</td>
        {{/compare}} {{#compare cfstubillstate 10}}
        <td>已结业</td>
        {{/compare}} {{#compare cfstubillstate 11}}
        <td>已退学</td>
        {{/compare}} {{#compare cfstubillstate 12}}
        <td>模拟考试合格</td>
        {{/compare}} {{#compare cfstubillstate 13}}
        <td>已过期</td>
        {{/compare}} {{#compare cfstubillstate 14}}
        <td>作废</td>
        {{/compare}} {{#compare cfstubillstate 15}}
        <td>科目三练车中,科目二未通过</td>
        {{/compare}} {{#compare cfstubillstate 16}}
        <td>科目三练车中,科目二未开始</td>
        {{/compare}} {{#compare cfstubillstate 17}}
        <td>科目三通过,科目二未通过</td>
        {{/compare}} {{#compare cfstubillstate 18}}
        <td>科目三通过,科目二练车中</td>
        {{/compare}} {{#compare cfstubillstate 19}}
        <td>科目三通过,科目二未开始</td>
        {{/compare}} {{#compare cfstubillstate 20}}
        <td>科目二未通过,科目三未通过</td>
        {{/compare}}{{#compare cfstubillstate 21}}
        <td>科目三未通过，科目二未开始</td>
        {{/compare}}{{#compare cfstubillstate 22}}
        <td>科目二练车中,科目三未通过</td>
        {{/compare}}
        <td>{{cfyishou}}</td>
        <td>{{cfysje}}</td>
        <td>{{cfyouhui}}</td>
        <td>{{cfqianfei}}</td>
        <td>{{kmykscs}}</td>
        <td>{{kmekscs}}</td>
        {{#compare cfbillstate 5}}
        <td>审核</td>
        {{/compare}}
        {{#compare cfbillstate 3}}
        <td>保存</td>
        {{/compare}}
        <td>{{jlname}}</td>

    </tr>
    {{/each}}
    {{else}}
    <td>没有搜索到您想要的内容!</td>
    {{/isNull}}

</script>
<script>
    //弹出框模版文件
    var myTemplate = Handlebars.compile($("#table-template").html());

    //注册一个比较内容是否为空
    Handlebars.registerHelper("isNull", function (v1, options) {
        if (v1 != "") {
            //满足添加继续执行
            return options.fn(this);
        } else {
            //不满足条件执行{{else}}部分
            return options.inverse(this);
        }
    });

    //注册一个比较大小的Helper,判断v1是否大于v2
    Handlebars.registerHelper("compare", function (v1, v2, options) {
        if (v2 == 100) {
            //满足添加继续执行
            return options.fn(this);
        }
        if (v1 == v2) {
            //满足添加继续执行
            return options.fn(this);
        } else {
            //不满足条件执行{{else}}部分
            return options.inverse(this);
        }
    });

    var beginTime = $("#datemin")
    var endTime = $("#datemax")
    var name1stu = $('.name1').val();
    var cflxdh = $('.cflxdh').val();

    //点击查找按钮
    $('#findBtn1').click(function () {
        name1stu = $('.name1').val();
        cflcsjid = $('.cflcsjid').val();
        var index = 0;
        $('#studebntList').html("<div class='loading'></div>");
        $.ajax({
            url: '<%=path2%>/DrivingSys/getPageDropexercise',
            type: "post",
            data: {
                'pindex': '0',
                'name': name1stu,
                'cflcsjid': cflcsjid,
                'state': 3
            },
            dataType: "json",
            success: function (res) {
                $('#studebntList').html(myTemplate(res));
                $('#totalPage').val(res.pb);
            },
            error: function () {
                alert('Error');
            }
        });

    })

    $('.indexPage').click(function () {
        var index = 0
        name1stu = $('.name1').val();
        $('#index').val(0)
        $.ajax({
            url: '<%=path2%>/DrivingSys/getPageDropexercise',
            type: "post",
            data: {
                'pindex': index,
                'name': name1stu,
                'cflcsjid': cflcsjid,
                'beginTime': beginTime.val(),
                'endTime': endTime.val(),
                'state': 3
            },
            dataType: "json",
            success: function (json) {
                $('#studebntList').html(myTemplate(json));
            },
            error: function () {
                alert('Error');
            }
        });
    })


    $('.endPage').click(function () {
        name1stu = $('.name1').val();
        var index = parseInt($('#totalPage').val())
        $('#index').val(index)
        $.ajax({
            url: '<%=path2%>/DrivingSys/getPageDropexercise',
            type: "post",
            data: {
                'pindex': index,
                'name': name1stu,
                'cflcsjid': cflcsjid,
                'beginTime': beginTime.val(),
                'endTime': endTime.val(),
                'state': 3
            },
            dataType: "json",
            success: function (json) {
                $('#studebntList').html(myTemplate(json));
            },
            error: function () {
                alert('Error');
            }
        });
    })


    $('.nextPage').click(function () {
        name1stu = $('.name1').val();
        var total = parseInt($('#totalPage').val())
        if ($('#index').val() < total) {
            var index = $('#index').val() - 0 + 1
            $('#index').val(index)
            $.ajax({
                url: '<%=path2%>/DrivingSys/getPageDropexercise',
                type: "post",
                data: {
                    'pindex': index,
                    'name': name1stu,
                    'cflcsjid': cflcsjid,
                    'beginTime': beginTime.val(),
                    'endTime': endTime.val(),
                    'state': 3
                },
                dataType: "json",
                success: function (json) {
                    $('#studebntList').html(myTemplate(json));
                },
                error: function () {
                    alert('Error');
                }
            });
        } else {
            alert("已经到尾页了！")
        }
    })


    $('.prevPage').click(function () {
        name1stu = $('.name1').val();
        if ($('#index').val() != '0') {
            var index = $('#index').val() - 0 - 1
            $('#index').val(index)
            $.ajax({
                url: '<%=path2%>/DrivingSys/getPageDropexercise',
                type: "post",
                data: {
                    'pindex': index,
                    'name': name1stu,
                    'cflcsjid': cflcsjid,
                    'beginTime': beginTime.val(),
                    'endTime': endTime.val(),
                    'state': 3
                },
                dataType: "json",
                success: function (json) {
                    $('#studebntList').html(myTemplate(json));
                },
                error: function () {
                    alert('Error');
                }
            });
        } else {
            alert("已经是首页了")
        }
    })
    //单击选中
    $(document).on('click', '#studebntList tr td', function () {
        $('.fir input:checkbox:checked').each(function (i) {
            $(this).removeAttr("checked");
        });
        if ($(this).parent().find(".fir input:checkbox").is(':checked')) {
            $(this).parent().find(".fir input:checkbox").removeAttr("checked");
        } else {
            $(this).parent().find(".fir input:checkbox").attr("checked", ":checked")
        }
    })

    //双击
    $(document).on('dblclick', '#studebntList tr td:not(td:first-child)', function () {
        $(this).parent().find("input:checkbox").attr("checked", ":checked")
        $('#subtn').click();
    })
</script>
</html>